package com.example.chat.model;

import com.example.chat.constant.StaticConstant;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;

/**
 * @author pq
 * @date 2022/8/13 23:09
 * @description 用户信息
 * @modified
 **/
@Data
@Entity
@Table(name = "user_info")
@ToString()
@EqualsAndHashCode(callSuper = true)
@DynamicInsert
@DynamicUpdate
public class User extends BaseEntity implements Serializable {

    /**
     * 主键
     */
    @Id
    @GenericGenerator(name = "uuid", strategy = "org.hibernate.id.UUIDGenerator")
    @GeneratedValue(generator = "uuid")
    @Column(name = "id", nullable = false)
    private String id;

    /**
     * 用户账号
     */
    @Column(name = "user_number", nullable = false)
    private String account;

    /**
     * 昵称
     */
    @Column(name = "user_nickname", nullable = false)
    private String nickname;

    /**
     * 用户头像
     */
    @Column(name = "user_avatar", nullable = false)
    private String avatar;

    /**
     * 用户状态 1正常 2禁用
     */
    @ApiModelProperty(name = "status")
    private Integer status= StaticConstant.ONE;
}
